import { fromJS } from "immutable";
import { ADD } from "./contant";

const defaultState: any =fromJS({
  count: 990,
});

interface TAction {
  type: string;
  count: number;
}

function reducer(state = defaultState, action: TAction) {
  const { type, count } = action;
  switch (type) {
    case ADD:
      return state.set("count",state.get("count") + count);
    default:
      return state;
  }
}

export default reducer;
